from datetime import datetime, timedelta
from os import write

from spreadsheet.data import *


def current_date_to_serial():
    """
    将当前日期转换为类似于 Excel 序列号的数字格式。

    返回:
        int: 转换后的序列号
    """
    # 定义基准日期
    base_date = datetime(1899, 12, 30)

    # 获取当前日期
    current_date = datetime.now()

    # 计算天数差
    delta = current_date - base_date

    return delta.days

keywords = {'校验不通过', '国家', '城市'}


if __name__ == '__main__':
    serial_number = current_date_to_serial() -2
    print(serial_number)
    data = ready("UVqes7rMPhvbhdt8vv2cQU2JnPh","美国万邑通仓","A1:N100")
    write_data = []
    for index,row in enumerate(data):
        if index < 2:
            continue
        if row[10]:
            write_data.append("")
            continue
        if row[0] > serial_number and any(keyword in row[3] for keyword in keywords):
            order_number = row[2]
            print(row[3])
            continue


